package com.shen;

import java.util.Calendar;
import java.util.Scanner;

/**
 * Author:shen
 * CreateDate:2020/5/31.
 * Function:
 */
public class MyTest03 {
    static Scanner scanner=new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("请输入年份：");
        int year=scanner.nextInt();
        test05(year);
    }

    public static void test05(int year){
        Calendar calendar=Calendar.getInstance();//由于是protected无法直接创建对象，
        calendar.set(Calendar.YEAR,year);
        calendar.set(Calendar.MONTH,6-1);
        calendar.set(Calendar.WEEK_OF_MONTH,3);
        calendar.set(Calendar.DAY_OF_WEEK,1);
        boolean flag=true;
        do{
            calendar.add(Calendar.DATE,1);
            if(calendar.get(Calendar.DAY_OF_WEEK)==1){
                System.out.println((calendar.get(Calendar.MONTH)+1)+"月"+calendar.get(Calendar.DATE)+"日");
            }
            if(calendar.get(Calendar.WEEK_OF_MONTH)==4){
                flag=false;
            }
        }while (flag);
    }
}
